<template>
  <el-popover
      content="😀我是智能阿威，本站的智能助手"
      placement="top">
    <template #reference>
      <el-button size="large" @click="openDialog">
        <el-icon>
          <SwitchFilled/>
        </el-icon>
      </el-button>
    </template>
  </el-popover>
  <el-dialog v-model="openStatus"
             append-to-body
             destroy-on-close
             title="智能助手"
             @close="closeDialog"
             style="min-height: 80vh;background: #f6f6f6"
             width="50%">
    <wave-single-dialog-a-i-chat-box-by-session style="background: white;"/>
  </el-dialog>
</template>
<script setup>
import {ref} from 'vue'
import {SwitchFilled} from "@element-plus/icons-vue";
import WaveSingleDialogAIChatBoxBySession from "@/views/system/ai/component/WaveSingleDialogAIChatBoxBySession.vue";
import {useAiSessionStore} from "@/store/AiSessionStore.js";

const aiSessionStore = useAiSessionStore();
const openStatus = ref(false)

const openDialog = () => {
  openStatus.value = true
}
const closeDialog = () => {
  openStatus.value = false
  console.log(aiSessionStore.bubbles.length > 1 && aiSessionStore.bubbles[0].typing === true)
  if (aiSessionStore.bubbles.length > 1 && aiSessionStore.bubbles[0].typing === true) {
    aiSessionStore.bubbles[0].typing = false
  }
}
</script>

<style scoped>

</style>